package invoice.header;

import invoice.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public abstract class Header implements Invoice{
    String title;
    String date;
    private Invoice component;

    Header(String t){
        title=t;
        setDate();
    }

    private void setDate(){
        date=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date());
    }

    public void decorate(Invoice comp){
        component=comp;
    }

    public void print(){
        if(component!=null)
            component.print();
    }

    protected abstract void printHeader();
}
